<template>
  <div>
    <div class="list-btn">
      日期:<DatePicker type="date" @on-change="startTime"  placeholder="选择开始日期" style="width: 200px" ></DatePicker>
      ～<DatePicker type="date" @on-change="endTime"  placeholder="选择结束日期" style="width: 200px"  ></DatePicker>
    </div>
    <div class="list-btn">
       渠道:
      <Select style="width:200px" v-model="params.channelCode" >
        <!--<Option value=" ">全部</Option>-->
        <Option v-for="(item,index) in channelCodeList" :value="item.channelCode" :key="index">{{ item.channelName }}</Option>
      </Select>
    </div>
    <div class="list-btn">
      <Button type="primary" @click="getList(url,'refresh')">搜索</Button>
    </div>
    <page-list :listTitle="listTitle" :list="list" :loading="loading" @selectItem="ids = $event;"></page-list>
    <page-button :current="params.pageCurrent"  :total="total" @changePageNum="params.pageCurrent = $event; getList(url)" @changePageSize="params.pageLimit = $event; getList(url)"></page-button>
  </div>
</template>

<script>
  import listMixin from '../../mixin/list'
  import pageList from '../../template/listTemplate'
  import pageButton from '../../template/pageBtnTemplate'
  import confirmDialog from '../../template/confirmDialogTemplate'
  export default {
    mixins:[listMixin],
    components: {
      pageList,
      pageButton,
      confirmDialog
    },
    methods:{

    },
    data () {
      return {
        tag: {
          'title': '渠道统计',
          'path': '/work/channelRate/list'
        },
        sysUser:[],
        statusList:[
          {
            id: 0,
            name:'未分配'
          },
          {
            id: 1,
            name: '已分配'
          }
        ],
        listTitle: [
          {
            title: '日期',
            minWidth: 70,
            key: 'channelDate',
            align:'left',
          },
          {
            title: '渠道名称',
            key: 'channelName',
            minWidth:70,
            align:'center',
            render: (h, params) => {
              return h('div', params.row.channelName?params.row.channelName : this.channelName)
            }
          },
          /*{
            title: '渠道代码',
            key: 'code',
            minWidth:70,
            align:'center'
          },*/
          {
            title: '注册数',
            key: 'registerNumber',
            minWidth:80,
            align:'center'
          },
          {
            title: '订单申请数',
            key: 'orderNumber',
            minWidth:75,
            align:'center'
          },
          {
            title: '风控通过数',
            key: 'riskControllerNumber',
            minWidth:70,
            align:'center'/*,
            render: (h, params) => {
              return h('div', this.toYuan(params.row.loanMoney))
            }*/
          },
        ],
        url: '/statistics/channel/list',
        nameListUrl: '',
        params: {
          //status:'',
          pageCurrent: 1,
          pageLimit: 10
        },

      }
    },
    mounted() {
      this.getChannel();
    },
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .list-btn{
    margin-bottom: 5px;
    margin-right: 5px;
    display: inline-block;
  }
  .refresh-btn{
    float: right;
  }

</style>
